cmake_minimum_required( VERSION 2.6 )

set(PROJECT radiola )

#set(QT_USE_QTXML 1)
#set(QT_USE_QTDBUS 1)

set(HEADERS
    playlists.h
    trayicon.h
)

set(SOURCES
    main.cpp
    playlists.cpp
    trayicon.cpp
)

set (MOCS
    trayicon.h
)

set(LIBRARIES
)

# QRC files .................
set(RESOURCES
    resource.qrc
)

# add translations ...
file (GLOB TS_FILES 
    translations/*.ts
)

set(DATA_DIR 
    ${CMAKE_INSTALL_PREFIX}/share/${PROJECT}
)

set(TRANSLATIONS_DIR
    "${DATA_DIR}/translations"
)
add_definitions(-DTRANSLATIONS_DIR=\"${TRANSLATIONS_DIR}\")

############################################
if (NOT CMAKE_BUILD_TYPE)
    set ( CMAKE_BUILD_TYPE Release )
endif (NOT CMAKE_BUILD_TYPE)

if(CMAKE_COMPILER_IS_GNUCXX)
        add_definitions (-Wall -pedantic)
endif()

#*******************************************
project(${PROJECT})

find_package(Qt4 REQUIRED)

include(${QT_USE_FILE})
qt4_wrap_cpp(MOC_SOURCES ${MOCS})
qt4_add_resources(QRC_SOURCES ${RESOURCES})
qt4_add_translation(QM_FILES ${TS_FILES})


add_executable(${PROJECT} ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${QM_FILES} ${QRC_SOURCES})
target_link_libraries(${PROJECT} ${LIBRARIES} ${QT_LIBRARIES})

install(FILES   misc/${PROJECT}.desktop DESTINATION "share/applications")
install(FILES   icons/radiola.png       DESTINATION "share/icons/hicolor/128x128/apps")
install(FILES   ${QM_FILES}             DESTINATION ${TRANSLATIONS_DIR})

install(TARGETS ${PROJECT} RUNTIME DESTINATION bin)




